<<<<<<< HEAD
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="black" name="apple-mobile-web-app-status-bar-style">
	<meta content="telephone=no" name="format-detection">
	<meta content="no-cache" http-equiv="Cache-Control">
	<title>源之东方</title>
	<link href="__STATIC__/css/shopin.css" rel="stylesheet"/>
	<link href="__STATIC__/css/swiper.css" rel="stylesheet"/>
</head>
<body>

<div class="m-detail">
	<div class="slide-banner">
		<div class="swiper-wrapper">
			{volist name="product_img" id="vo"}
			<div class="swiper-slide"><img src="__STATIC__/{$vo.img.url}"></div>
			{/volist}
		</div>
		<div class="swiper-pagination"></div>
		<a href="javascript:;" class="a-back"></a>
		<a href="javascript:;" class="a-cart"></a>
	</div><!-- //焦点图结束 -->

	<div class="d">
		<h3 class="d-title clamp">{$product_info.product.name}{$product_info.product.summary}</h3>
		<div class="d-main flex">
			<p class="price cell">
				<del>普通会员￥{$product_info.price}(p)</del>
				<span class="s">￥{$product_info.member_price}(vip)</span>
			</p>
			<!--<p class="discount"><b>3折</b></p>-->
		</div>
	</div>

	<div class="m-action">
		<div class="m-only sku"><a href="javascript:skuOpen();" class="btn-link a-sku">请选择需要购买的商品</a></div>
	</div>
	<div class="picDetail mt">
		<!--<div class="btn btn-block view-picture">图片详情</div>-->
		<div class="pic-text">
			<div class="m-text product-text mt">
				<ul>
					<li>
						<s>品牌：</s>
						<b>艾瑞纳</b>
					</li>
					<li>
						<s>款号：</s>
						<b>Q011-65</b>
					</li>
					<li>
						<s>颜色分类：</s>
						<b>粉红色</b>
					</li>
				</ul>
			</div><!-- 商品信息 -->
			<div class="pic-container mt">
				{volist name="product_img" id="vo"}
				<a href="#"><img src="__STATIC__/{$vo.img.url}"></a>
				{/volist}
			</div>
		</div>
	</div>
</div>

<div class="buy-bar buy-fixed flex">
	<a class="add-cart cell" href="#;">￥{$home.price}</a>
	<a class="buy-now cell" href="javascript:addCart();">加入购物车</a>
	<a class="go-cart" href="/cart.html"><span>购物车</span><i class="icon">{if condition="isset($product_count)"} {$product_count} {else /} 0 {/if}</i></a>
</div>

<div class="m-sku">
	<div class="sku-mask"></div>
	<div class="sku-panel">
		<div class="sku-top"><span class="sku-close">X</span></div>
		<div class="sku-content" id="color_size">
			<div class="row-title">颜色/类型</div>
			<div class="sku-row" id="j_color">
				{volist name="product_all" id="vo"}
				{if condition="$vo.is_home eq 1"}
				<a class="sku-item on" href="javascript:;" data-product="{$vo.product_id}" data-color="{$vo.color}" data-load="0">{$vo.color}</a>
				{else /}
				<a class="sku-item" href="javascript:;" data-product="{$vo.product_id}" data-color="{$vo.color}" data-load="0">{$vo.color}</a>
				{/if}
				{/volist}
			</div>
			<div class="row-title" id="j_size_div" style="display: none">尺码/大小</div>
			<div class="sku-row" id="j_size" style="display: none">
				<!--<a class="sku-item" href="javascript:;">38(5.5)</a>-->
			</div>
		</div>
		<div class="sku-footer">
			<a href="javascript;" class="btn-cancel">￥{$home.price}</a>
			<a href="javascript:addCart();" class="btn-submit">加入购物车</a>
		</div>
	</div>
</div>

<script src="__STATIC__/js/zepto.min.js"></script>
<script src="__STATIC__/js/base.min.js"></script>
<script src="__STATIC__/js/swiper.js"></script>
<script src="__STATIC__/js/shopin.js"></script>
<script>
    //焦点图
    var mySwiper = new Swiper ('.slide-banner', {
        pagination: '.swiper-pagination',
        autoplay: 3000,
        autoplayDisableOnInteraction: false
    });

    //选择颜色、尺码
    $('.m-sku .sku-row .sku-item').live('tap', function(){
        if($(this).hasClass('on')){
            $(this).removeClass('on');
        }else{
            $(this).addClass('on').siblings().removeClass('on');
        };
        skuSubmit();
    });

    //open SKU
    function skuOpen (){
        $('.sku-panel').addClass('sku-move');
        $('.sku-mask, .sku-panel').css('display','block');
    };

    //获取选定的颜色和尺码
    function skuSubmit() {
        var colorValue = $("#j_color").find(".on").text();
        var sizeValue = $("#j_size").find(".on").text();
        if(colorValue != null && sizeValue == null){
            $(".a-sku").text('颜色：' + colorValue + '　选择尺码');
        }
        if(colorValue == null && sizeValue != null){
            $(".a-sku").text('尺码：' + sizeValue + '　选择颜色');
        }
        if(colorValue == null && sizeValue == null){
            $(".a-sku").text("请选择颜色尺码");
        }
        if(colorValue != null && sizeValue != null){
            $(".a-sku").text(colorValue + ' ' + sizeValue);
        }
    };

    //close SKU
    $('.sku-mask, .sku-close').on('tap', function() {
        $('.sku-panel').addClass('sku-back');
        setTimeout("skuClose()", 300 )
    });
    function skuClose(){
        $('.sku-panel').removeClass('sku-back')
        $('.sku-panel, .sku-mask').css('display','none');
    };
</script>
<script src="__STATIC__/js/jquery-3.1.1.min.js"></script>
<script>
    $.noConflict();
    jQuery('#j_color a').click(function () {
        var is_click = jQuery(this).attr('data-load');
        if(is_click == 1) {
            jQuery('#j_size a').css('display', 'none');
            var color = jQuery(this).attr('data-color');
            var product = jQuery(this).attr('data-product');
            jQuery('#j_size a[data-product="' + product + '"][data-color="' + color + '"]').css('display', 'inline-block');
			jQuery(this).addClass('on');
            return true;
        }
        jQuery('#j_color a').find('.on').removeClass('on');
        jQuery(this).addClass('on');
        var that = jQuery(this);
        var color = jQuery(this).attr('data-color');
        var product = jQuery(this).attr('data-product');
        jQuery.ajax({
            type : 'post',
            dataType : 'json',
            data:{
                product_id : product,
                color : color
            },
            url : "/product_size",
            async : true,
            success:function(data){
                var rows = data.data;
                if(data.status == 0) {
                }
                if(data.status == 1){
                    that.attr('data-load', 1);
                    jQuery('#j_size a').css('display', 'none');
                    var le = rows.length;
                    if(le > 0) {
                        for (var i = 0; i < le; i++) {
                            var a = '<a class="sku-item" href="javascript:;" data-id="' + rows[i].id + '" style="display: inline-block;" data-product="' + rows[i].product_id + '" data-color="' + rows[i].color + '">' + rows[i].size + '</a>';
                            jQuery('#j_size').append(a);
                        }
                    } else {
                        jQuery('#j_size_div').css('display', 'none');
                    }
                    jQuery('#j_size_div').css('display', 'block');
                    jQuery('#j_size').css('display', 'block');
                    jQuery('#j_size a').click(function () {
                        jQuery('#j_size a').find('.on').removeClass('on');
                        jQuery(this).addClass('on');
                    });
                }
            },
            error:function(e){
                console.log(e);
            }
        });
    });
    var color = "{$home.color}";
    jQuery('#j_color a[data-color="' + color + '"]').click();
</script>
<script>
    function addCart(){
        if(jQuery('.sku-panel').hasClass('sku-move')){
            var colorValue = jQuery("#j_color").find(".on").text();
            var sizeValue = jQuery("#j_size").find(".on").text();
            if(!colorValue || !sizeValue){
                alert('请选择您要选择的商品类型');
                skuOpen();
                return false;
            }
            if(colorValue && sizeValue){
                var getCartNum = parseInt(jQuery('.go-cart .icon').text());
                skuClose();
                var primary = jQuery("#j_size").find(".on").attr('data-id');
                jQuery.ajax({
                    type : 'post',
                    dataType : 'json',
                    data:{
                        id : primary
                    },
                    url : "/addToCart",
                    async : true,
                    success:function(data){
                        if(data.status == 1) {
                            var setCartNum = getCartNum + 1; // 数量加 1
                            $('.go-cart .icon').text(setCartNum);
                            alert(data.message);
                        }
                        if(data.status == 0) {
                            alert(data.message);
                        }
                    },
                    error:function(e){
                        //异常处理；
                        var error = e.responseJSON.msg;
                        var arr = Object.values(error);
                        alert(arr);
                    }
                });
            }
        } else {
            skuOpen();
        }
    }
    function skuOpen (){
        $('.sku-panel').addClass('sku-move');
        $('.sku-mask, .sku-panel').css('display','block');
    }
</script>
</body>
=======
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="black" name="apple-mobile-web-app-status-bar-style">
	<meta content="telephone=no" name="format-detection">
	<meta content="no-cache" http-equiv="Cache-Control">
	<title>源之东方</title>
	<link href="__STATIC__/css/shopin.css" rel="stylesheet"/>
	<link href="__STATIC__/css/swiper.css" rel="stylesheet"/>
</head>
<body>

<div class="m-detail">
	<div class="slide-banner">
		<div class="swiper-wrapper">
			{volist name="product_img" id="vo"}
			<div class="swiper-slide"><img src="__STATIC__/{$vo.img.url}"></div>
			{/volist}
		</div>
		<div class="swiper-pagination"></div>
		<a href="javascript:;" class="a-back"></a>
		<a href="javascript:;" class="a-cart"></a>
	</div><!-- //焦点图结束 -->

	<div class="d">
		<h3 class="d-title clamp">{$product_info.product.name}{$product_info.product.summary}</h3>
		<div class="d-main flex">
			<p class="price cell">
				<del>普通会员￥{$product_info.price}(p)</del>
				<span class="s">￥{$product_info.member_price}(vip)</span>
			</p>
			<!--<p class="discount"><b>3折</b></p>-->
		</div>
	</div>

	<div class="m-action">
		<div class="m-only sku"><a href="javascript:skuOpen();" class="btn-link a-sku">请选择需要购买的商品</a></div>
	</div>
	<div class="picDetail mt">
		<!--<div class="btn btn-block view-picture">图片详情</div>-->
		<div class="pic-text">
			<div class="m-text product-text mt">
				<ul>
					<li>
						<s>品牌：</s>
						<b>艾瑞纳</b>
					</li>
					<li>
						<s>款号：</s>
						<b>Q011-65</b>
					</li>
					<li>
						<s>颜色分类：</s>
						<b>粉红色</b>
					</li>
				</ul>
			</div><!-- 商品信息 -->
			<div class="pic-container mt">
				{volist name="product_img" id="vo"}
				<a href="#"><img src="__STATIC__/{$vo.img.url}"></a>
				{/volist}
			</div>
		</div>
	</div>
</div>

<div class="buy-bar buy-fixed flex">
	<a class="add-cart cell" href="#;">￥{$home.price}</a>
	<a class="buy-now cell" href="javascript:addCart();">加入购物车</a>
	<a class="go-cart" href="/cart.html"><span>购物车</span><i class="icon">{if condition="isset($product_count)"} {$product_count} {else /} 0 {/if}</i></a>
</div>

<div class="m-sku">
	<div class="sku-mask"></div>
	<div class="sku-panel">
		<div class="sku-top"><span class="sku-close">X</span></div>
		<div class="sku-content" id="color_size">
			<div class="row-title">颜色/类型</div>
			<div class="sku-row" id="j_color">
				{volist name="product_all" id="vo"}
				{if condition="$vo.is_home eq 1"}
				<a class="sku-item on" href="javascript:;" data-product="{$vo.product_id}" data-color="{$vo.color}" data-load="0">{$vo.color}</a>
				{else /}
				<a class="sku-item" href="javascript:;" data-product="{$vo.product_id}" data-color="{$vo.color}" data-load="0">{$vo.color}</a>
				{/if}
				{/volist}
			</div>
			<div class="row-title" id="j_size_div" style="display: none">尺码/大小</div>
			<div class="sku-row" id="j_size" style="display: none">
				<!--<a class="sku-item" href="javascript:;">38(5.5)</a>-->
			</div>
		</div>
		<div class="sku-footer">
			<a href="javascript;" class="btn-cancel">￥{$home.price}</a>
			<a href="javascript:addCart();" class="btn-submit">加入购物车</a>
		</div>
	</div>
</div>

<script src="__STATIC__/js/zepto.min.js"></script>
<script src="__STATIC__/js/base.min.js"></script>
<script src="__STATIC__/js/swiper.js"></script>
<script src="__STATIC__/js/shopin.js"></script>
<script>
    //焦点图
    var mySwiper = new Swiper ('.slide-banner', {
        pagination: '.swiper-pagination',
        autoplay: 3000,
        autoplayDisableOnInteraction: false
    });

    //选择颜色、尺码
    $('.m-sku .sku-row .sku-item').live('tap', function(){
        if($(this).hasClass('on')){
            $(this).removeClass('on');
        }else{
            $(this).addClass('on').siblings().removeClass('on');
        };
        skuSubmit();
    });

    //open SKU
    function skuOpen (){
        $('.sku-panel').addClass('sku-move');
        $('.sku-mask, .sku-panel').css('display','block');
    };

    //获取选定的颜色和尺码
    function skuSubmit() {
        var colorValue = $("#j_color").find(".on").text();
        var sizeValue = $("#j_size").find(".on").text();
        if(colorValue != null && sizeValue == null){
            $(".a-sku").text('颜色：' + colorValue + '　选择尺码');
        }
        if(colorValue == null && sizeValue != null){
            $(".a-sku").text('尺码：' + sizeValue + '　选择颜色');
        }
        if(colorValue == null && sizeValue == null){
            $(".a-sku").text("请选择颜色尺码");
        }
        if(colorValue != null && sizeValue != null){
            $(".a-sku").text(colorValue + ' ' + sizeValue);
        }
    };

    //close SKU
    $('.sku-mask, .sku-close').on('tap', function() {
        $('.sku-panel').addClass('sku-back');
        setTimeout("skuClose()", 300 )
    });
    function skuClose(){
        $('.sku-panel').removeClass('sku-back')
        $('.sku-panel, .sku-mask').css('display','none');
    };
</script>
<script src="__STATIC__/js/jquery-3.1.1.min.js"></script>
<script>
    $.noConflict();
    jQuery('#j_color a').click(function () {
        var is_click = jQuery(this).attr('data-load');
        if(is_click == 1) {
            jQuery('#j_size a').css('display', 'none');
            var color = jQuery(this).attr('data-color');
            var product = jQuery(this).attr('data-product');
            jQuery('#j_size a[data-product="' + product + '"][data-color="' + color + '"]').css('display', 'inline-block');
			jQuery(this).addClass('on');
            return true;
        }
        jQuery('#j_color a').find('.on').removeClass('on');
        jQuery(this).addClass('on');
        var that = jQuery(this);
        var color = jQuery(this).attr('data-color');
        var product = jQuery(this).attr('data-product');
        jQuery.ajax({
            type : 'post',
            dataType : 'json',
            data:{
                product_id : product,
                color : color
            },
            url : "/product_size",
            async : true,
            success:function(data){
                var rows = data.data;
                if(data.status == 0) {
                }
                if(data.status == 1){
                    that.attr('data-load', 1);
                    jQuery('#j_size a').css('display', 'none');
                    var le = rows.length;
                    if(le > 0) {
                        for (var i = 0; i < le; i++) {
                            var a = '<a class="sku-item" href="javascript:;" data-id="' + rows[i].id + '" style="display: inline-block;" data-product="' + rows[i].product_id + '" data-color="' + rows[i].color + '">' + rows[i].size + '</a>';
                            jQuery('#j_size').append(a);
                        }
                    } else {
                        jQuery('#j_size_div').css('display', 'none');
                    }
                    jQuery('#j_size_div').css('display', 'block');
                    jQuery('#j_size').css('display', 'block');
                    jQuery('#j_size a').click(function () {
                        jQuery('#j_size a').find('.on').removeClass('on');
                        jQuery(this).addClass('on');
                    });
                }
            },
            error:function(e){
                console.log(e);
            }
        });
    });
    var color = "{$home.color}";
    jQuery('#j_color a[data-color="' + color + '"]').click();
</script>
<script>
    function addCart(){
        if(jQuery('.sku-panel').hasClass('sku-move')){
            var colorValue = jQuery("#j_color").find(".on").text();
            var sizeValue = jQuery("#j_size").find(".on").text();
            if(!colorValue || !sizeValue){
                alert('请选择您要选择的商品类型');
                skuOpen();
                return false;
            }
            if(colorValue && sizeValue){
                var getCartNum = parseInt(jQuery('.go-cart .icon').text());
                skuClose();
                var primary = jQuery("#j_size").find(".on").attr('data-id');
                jQuery.ajax({
                    type : 'post',
                    dataType : 'json',
                    data:{
                        id : primary
                    },
                    url : "/addToCart",
                    async : true,
                    success:function(data){
                        if(data.status == 1) {
                            var setCartNum = getCartNum + 1; // 数量加 1
                            $('.go-cart .icon').text(setCartNum);
                            alert(data.message);
                        }
                        if(data.status == 0) {
                            alert(data.message);
                        }
                    },
                    error:function(e){
                        //异常处理；
                        var error = e.responseJSON.msg;
                        var arr = Object.values(error);
                        alert(arr);
                    }
                });
            }
        } else {
            skuOpen();
        }
    }
    function skuOpen (){
        $('.sku-panel').addClass('sku-move');
        $('.sku-mask, .sku-panel').css('display','block');
    }
</script>
</body>
>>>>>>> 93c40d8086b7a8d5a9aa3548fdc8eb06a4272cf7
</html>